#include <bits/stdc++.h>
// 2025/01/23
// tag: HASH
// Author: Zhang Muen
using namespace std;

int n, cnt;

signed main()
{
    unordered_map<string, int> m;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int type;
        string s;
        cin >> type;
        switch (type)
        {
        case 1:
            cin >> s >> type;
            if (m[s] <= 0)
                cnt++;
            m[s] = type, cout << "OK" << endl;
            break;
        case 2:
            cin >> s;
            if (m[s] > 0)
                cout << m[s] << endl;
            else
                cout << "Not found" << endl;
            break;
        case 3:
            cin >> s;
            if (m[s] <= 0)
                cout << "Not found" << endl;
            else
                cnt--, m[s] = 0, cout << "Deleted successfully" << endl;
            break;
        case 4:
            cout << cnt << endl;
            break;
        }
    }
    return 0;
}